//
//  SHHistoryCell.m
//  MyProject
//
//  Created by Pei on 16/7/30.
//  Copyright © 2016年 Xiaobo Pei. All rights reserved.
//

#import "SHHistoryCell.h"

@implementation SHHistoryCell
{
    UIImageView *headerImageView;
    UILabel *nameLbl;
    UILabel *dateLbl;
    UILabel *statusLbl;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundColor = kDefaultBackgroundColor;
        
        UIView *contentView = [[UIView alloc] init];
        contentView.frame = CGRectMake(40.0f, 10.0f, kDeviceWidth-40.0f-10.0f, 54.0f);
        contentView.backgroundColor = kWhiteColor;
        [self addSubview:contentView];
        
        headerImageView = [[UIImageView alloc] init];
        headerImageView.frame = CGRectMake(10.0f, 10.0f, 34.0f, 34.0f);
        headerImageView.layer.masksToBounds = YES;
        headerImageView.layer.cornerRadius = 17.0f;
        headerImageView.backgroundColor = kGreenColor;
        [contentView addSubview:headerImageView];
        
        nameLbl = [[UILabel alloc] init];
        nameLbl.frame = CGRectMake(headerImageView.right+5.0f, headerImageView.origin.y, 80, Home_Big_Size);
        nameLbl.font = kAppFont(Home_Big_Size);
        nameLbl.text = @"HHHH";
        [contentView addSubview:nameLbl];
        
        dateLbl = [[UILabel alloc] init];
        dateLbl.frame = CGRectMake(nameLbl.right, headerImageView.origin.y, contentView.width-10.0f-headerImageView.width-5.0f-nameLbl.width, Home_Small_Size);
        dateLbl.font = kAppFont(Home_Small_Size);
        dateLbl.textColor = kGreenColor;
        dateLbl.text = @"2016-7-6";
        dateLbl.textAlignment = NSTextAlignmentRight;
        [contentView addSubview:dateLbl];
        
        statusLbl = [[UILabel alloc] init];
        statusLbl.frame = CGRectMake(headerImageView.right+5.0f, nameLbl.bottom+5.0f, contentView.width-10.0f-headerImageView.width-5.0f, Home_Small_Size);
        statusLbl.font = kAppFont(Home_Small_Size);
        statusLbl.textColor = kGreenColor;
        statusLbl.textAlignment = NSTextAlignmentRight;
        [contentView addSubview:statusLbl];

    }
    return self;
}

- (void)showWithData:(NSDictionary*)data{
    nameLbl.text = [data valueForKey:@"AuditUser"];
    dateLbl.text = [data valueForKey:@"AuditDate"];
    statusLbl.text = [NSString stringWithFormat:@"(%@)%@",[data valueForKey:@"AuditResult"],[data valueForKey:@"AuditDesc"]];
}

@end
